package com.meritit.config.single;

public class Singleton {
    private static Singleton singleton = null;
    
    private int num = 0;
    
    private Singleton () {}
    public static Singleton getSingleton () {
        if (singleton == null) {
            System.out.println("=====执行=====");
            singleton = new Singleton();
        }
        return singleton;
    };

    public int getNum(){
    	return this.num;
    }
    
    public void addNum() {
    	this.num = this.num + 1;
    }
    
    @Override
    public String toString() {
    	return "Singleton【" + this.hashCode() + "】";
    }
}
